/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.biblioteca.vo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.Version;

/**
 *
 * @author joaosavio
 */
@Entity
public class User implements Serializable {
    @Version
    private int version;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long id;

    @Column(length = 30, nullable = false, unique = true)
    private String login;

    @Column(length = 32, nullable = false)
    private String password;

    @Temporal(javax.persistence.TemporalType.DATE)
    private Date lastPasswordDateUpdated;

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Date getLastPasswordDateUpdated() {
        return lastPasswordDateUpdated;
    }

    public void setLastPasswordDateUpdated(Date lastPasswordDateUpdated) {
        this.lastPasswordDateUpdated = lastPasswordDateUpdated;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final User other = (User) obj;
        if ((this.login == null) ? (other.login != null) : !this.login.equals(other.login)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 89 * hash + (int) (this.id ^ (this.id >>> 32));
        return hash;
    }

    
}
